package com.mcgrady.start;

import org.junit.Test;

import java.math.BigDecimal;

/**
 * @author McGrady
 */
public class BasicTypeTest {
    @Test
    public void byteType() {
        byte numA = 100;
        System.out.println(numA);
        short numB = 10000;
        System.out.println(numB);
        int numC = 100000000;
        System.out.println(numC);
        long numD = 100000000000000000L;
        System.out.println(numD);
        System.out.println(1111111111111111L);
    }
    @Test
    public void floatType(){
        float num1 = 3.14F;
        System.out.println(num1);
        double num2 = 3.141592;
        System.out.println(num2);
        System.out.println(5.00-3.70);
        System.out.println(new BigDecimal("5.00").subtract(new BigDecimal("3.70")));
    }
    @Test
    public void charType(){
        char wordA = 'a';
        System.out.println(wordA);
        char wordB = 65;
        System.out.println(wordB);
    }
    @Test
    public void booleanType(){
        boolean flag = true;
        System.out.println(flag);
        flag = false;
        System.out.println(flag);
    }
    @Test
    public void typeConversion(){
        int numA = 100;
        long numB = numA;
        System.out.println(numA);
        System.out.println(numB);

        long numC = 100L;
        short numD = (short) numC;
        System.out.println(numC);
        System.out.println(numD);

        int numE  = 100;
        double numF = numE;
        System.out.println(numE);
        System.out.println(numF);

        double numG = 4.99;
        int numH = (int) numG;
        System.out.println(numG);
        System.out.println(numH);

        char wordA = 'a';
        double result = wordA;
        System.out.println(wordA);
        System.out.println(result);
    }
    @Test
    public void calculation(){
        int numA = 10;
        long numB = 100L;
        int result = (int) (numA+numB);
        System.out.println(result);

        char word = 'a';
        System.out.println(word+10);
    }
}
